package io.agora;

import io.agora.media.RtcTokenBuilder;

public class RtcTokenBuilderSample {
    static String appId = "你的appid";
    static String appCertificate = "你的appCertificate（主证书）";
    static String channelName = "你的频道名";
    static String userAccount = "用户名";
    static int uid = 0;
    static int expirationTimeInSeconds = 3600*24*90;

    public static void main(String[] args) throws Exception {
        RtcTokenBuilder token = new RtcTokenBuilder();
        int timestamp = (int)(System.currentTimeMillis() / 1000 + expirationTimeInSeconds);
        String result = token.buildTokenWithUserAccount(appId, appCertificate,
                channelName, userAccount, RtcTokenBuilder.Role.Role_Publisher, timestamp);
        System.out.println(result);

        result = token.buildTokenWithUid(appId, appCertificate,
                channelName, uid, RtcTokenBuilder.Role.Role_Publisher, timestamp);
        System.out.println(result);
    }
}